package com.cashmama.market.api.application.controller.user.request;

import com.cashmama.market.api.infras.exception.ApplicationException;
import com.cashmama.market.api.infras.utils.StringUtils;
import com.fqgj.common.api.ParamsObject;

/**
 * @program: market-api
 * @description
 * @author: frank
 * @create: 2019-12-27 09:51
 **/
public class UserSaveAvatarRequest extends ParamsObject {

    private String avatar;
    private String nickname;

    public String getAvatar() {
        return avatar;
    }

    public UserSaveAvatarRequest setAvatar(String avatar) {
        this.avatar = avatar;
        return this;
    }

    public String getNickname() {
        return nickname;
    }

    public UserSaveAvatarRequest setNickname(String nickname) {
        this.nickname = nickname;
        return this;
    }

    @Override
    public void validate() {
        if(StringUtils.isEmpty(avatar)){
            throw new ApplicationException("avatar can not be empty");
        }
        if(StringUtils.isEmpty(nickname)){
            throw new ApplicationException("nickname can not be empty");
        }
    }
}
